#!/bin/sh
# auto_verify.tcl 
source src/configXML.tcl

set confFile "global/system.xml"

initXml $confFile

#返回system-info中的信息
#返回值为一个字典，字典的键为：
#log-path
#result-path
#adaptor-path
proc getSystemInfo {} {
	global root
	set systemInfoNode [$root selectNodes /system/system-info]
	set logPath [parseTextInfo $systemInfoNode log-path]
	set resultPath [parseTextInfo $systemInfoNode result-path]
	set adaptorPath [parseTextInfo $systemInfoNode adaptor-path]
	dict append systemInfo log-path $logPath
	dict append systemInfo result-path $resultPath
	dict append systemInfo adaptor-path $adaptorPath
	return $systemInfo
}

#返回所有Test-Unit的信息
#返回值是一个链表，链表的每个元素是一个Test-Unit信息组成的字典
#字典的键为：
#id
#test-path
proc getTestUnits {} {
	global root
	set testUnitsNode [$root selectNodes /system/Test-Units]
	set units {}
	foreach testUnitNode [$testUnitsNode childNodes] {
		set unit ""
		set id [parseTextInfo $testUnitNode id]
		set testPath [parseTextInfo $testUnitNode test-path]
		dict append unit id $id
		dict append unit test-path $testPath
		lappend units $unit
	}
	return $units
}

puts [getTestUnits]